<html lang=<?php echo $config['lang']; ?>>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, maximum-scale=1.0"/>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
<style>
<?php include('global.css'); ?>
<?php include('config.css'); ?>
<?php if ( file_exists( "fix.css" ) ) { include( "fix.css" ); } ?>
</style>
</head>
    <body>
        <div class=info-box></div>
        <?php include('header.php'); ?>
        <main>

            <div class="config-box">
                <div>URL входа</div>
                <div><input name=login_url type=text value="<?php echo $config['login_url']; ?>"></div>
                <div>Пароль</div>
                <div><input name=password type=text value="<?php echo $config['password']; ?>"></div>
                <div><button data-save-password><?php echo __('Save'); ?></button></div>
            </div>

            <div class="config-box">
                <div class=header-with-buttons><span>Загрузить аватарку</span>
                <form data-avatar-form action=/api method=post>
                    <input type=hidden name=fn value=upload_my_ava>
                    <input id=upload-my-ava type=file name="myfile" class=hide-upload-btn>
                    <label for=upload-my-ava>
                        <svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" viewBox="0 0 20 17">
                            <path d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"></path>
                        </svg>
                    </label>
                </form>
                </div>
                <div class=ava-img><?php if ( !empty( $config['avatar'] ) ) { echo "<img src='{$config['avatar']}'>"; } else { echo "no image"; } ?></div>
            </div>

            <div class="config-box">
                <div>Активные сессии</div>
                <?php
                    foreach ( $config['logged'] as $login => $oth ) {
                        if ( $_COOKIE['soc_login'] === $login ) {
                            $current = 'current';
                        } else {
                            $current = '';
                        }
                        echo "<div class='session {$current}' data-sess={$login}><span class=del data-del-sess={$login}>X</span> <span class=date>{$oth['date']}</span> <span class=ip>{$oth['ip']}</span> <span class=sess>{$login}</span></div>";
                    }
                ?>
            </div>

        </main>
        <?php include('footer.php'); ?>
    </body>
</html>